<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>发起 - Blog</title>
</head>
<head th:replace="~{common/import :: tophead}"></head>
<head th:replace="~{common/import :: markdown}"></head>
<body>
<div th:replace="~{common/topBar :: nav}"></div>
<div class="container-fluid main" id="contentMain" th:object="${blog}">
    <div class="row">
        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <h4><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> 发起</h4>
            <hr>
            <form th:action="@{/publish}" method="post">
                <input type="hidden" name="id" th:value="*{id}">
                <div class="form-group">
                    <label for="title">Blog标题（简单扼要）：</label>
                    <input type="text" class="form-control" th:value="*{title}" id="title" name="title" placeholder="Blog标题..." autocomplete="off" required data-bv-notempty-message="标题不能为空">
                </div>
                <div class="form-group">
                    <label for="title">Blog描述（简单扼要）：</label>
                    <input type="text" class="form-control" th:value="*{description}" id="description" name="description" placeholder="Blog描述..." autocomplete="off" required data-bv-notempty-message="描述不能为空">
                </div>
                <label for="title">Blog内容（必填）：</label>
                <div class="form-group" id="question-editor">
                    <textarea name="content" id="content" class="form-control"
                              placeholder="Blog内容..."
                              th:text="*{content}"
                              cols="30"
                              rows="10"
                              autocomplete="off"
                              style="display: none">
                    </textarea>
                </div>

                <div class="form-group">
                    <label for="tags">添加标签：(填写一个或者多个合适的标签，用逗号分隔)</label>
                    <input type="text" class="form-control" th:value="*{tags}" id="tags" name="tags" placeholder="输入标签，用逗号分隔" onfocus="showSelectTag()" autocomplete="off">
                    <div id="select-tag" class="publish-tag-tab">
                        <!-- Nav tabs -->
                        <ul class="nav nav-tabs" role="tablist">
                            <li role="presentation" th:each="selectCategory,selectCategoryStat : ${tags}" class="select-Category">
                                <a th:href="${'#'+selectCategory.categoryName}" aria-controls="home" role="tab" data-toggle="tab"
                                   th:text="${selectCategory.categoryName}"></a>
                            </li>
                        </ul>
                        <!-- Tab panes -->
                        <div class="tab-content publish-tab-content">
                            <div role="tabpanel"
                                 th:id="${selectCategory.categoryName}"
                                 th:each="selectCategory : ${tags}"
                                 th:class="${selectCategoryStat.first ? 'active tab-pane' : 'tab-pane'}">
                                <span class="label label-info publish-tag" onclick="selectTag(this)" th:data-tag="${selectTag}"
                                      th:each="selectTag : ${selectCategory.tags}">
                                    <span class="glyphicon glyphicon-tag publish-tag" th:text="${selectTag}"></span>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="container-fluid">
                    <div class="row">
                        <div class="alert alert-danger col-lg-12 col-md-12 col-sm-12 col-xs-12" th:if="${error != null}" th:text="${error}"></div>
                    </div>
                    <div class="row">
                        <div>
                            <button type="submit" class="btn btn-success">发布</button>
                        </div>
                        <div class="checkbox pull-left">
                            <label>
                                <input type="checkbox" id="published" name="published" th:checked="!*{published}">草稿
                            </label>
                        </div>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
<div th:replace="~{common/footer :: foot}"></div>
</body>
<script type="text/javascript">
    $(document).ready(function() {
        $('#defaultForm').bootstrapValidator();
    });
</script>
</html>